//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

//
// TODO generated message class
//

//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

//
// @file MobiSenseAppMessage.msg
// @author he huang
//

cplusplus {{
#include <CommonMessages_m.h>
#include <Coordinates.h>
#include <CycleTargetArea.h>
#include <vector>

static const int MOBISENSETYPE_L = 8;
static const int COORD_L = 2 * sizeof(double);

#define MOBISENSEAPP_SUB_L(msg) ( MOBISENSETYPE_L + sizeof(long) + msg->getArea().sizeInBits() )
#define MOBISENSEAPP_PUB_L(msg) ( MOBISENSETYPE_L + sizeof(long) + COORD_L )
#define MOBISENSEAPP_NOTIFY_L(msg) ( MOBISENSETYPE_L + sizeof(long))
}}

class noncobject OverlayKey;
class noncobject Coordinates;
class noncobject CycleTargetArea;

// First, we declare an enum for the message type:
// Enumerations in messages MUST have a value.

enum MobiSenseAppMessageType 
{
    MOBISENSE_APP_SUB = 1;           // broker message, subscription installation
    MOBISENSE_APP_PUB = 2;           // broker message, publish sensing data to RP according to the partition
    MOBISENSE_APP_NOTIFY = 3;			// broker message, notify all interesting brokers
}

packet MobiSenseAppPkt
{
    int type enum (MobiSenseAppMessageType); // message type
}

// subscription installation message, location-based multicast
packet MobiSenseAppSub extends MobiSenseAppPkt
{    
    CycleTargetArea area;	// target area
    //long clientID;	// unique client id
    //long sid;				// seq# of subscriptions from one client
    long eid;				// event id
    //OverlayKey src;			// source broker id of the subscription
    //Filter filter;
}

// sensing data publishing message sending to the RP broker
packet MobiSenseAppPub extends MobiSenseAppPkt
{
    Coordinates coordinate;			// src of event
    long eid;						// event id
}

// notification of sensing data, id-based multicast
packet MobiSenseAppNotify extends MobiSenseAppPkt
{
    long eid;						// event id
}



